export interface NodeType {
    type: string,
    category: string,
    name: string,
    icon: Object
}

export interface FlowAPI {
    getFlow?: (data: any) => Promise<any>;
    getFlowList?: () => Promise<any>;
    saveFlow?: (data: FlowData) => Promise<any>;
    deleteFlow?: (data: any) => Promise<any>;
    runFlow?: (data: FlowData) => Promise<any>;
    sendStreamMessage?: (params: { id: string; message: string }) => Promise<ReadableStream>;

    addModel?: (data: any) => Promise<any>;
    deleteModel?: (data: any) => Promise<any>;
    getModelList?: () => Promise<any>;
    getModel?: (data: any) => Promise<any>;
    getModelNames?: (data: any) => Promise<any>

    addMcp: (data: any) => Promise<any>;
    deleteMcp: (data: any) => Promise<any>;
    getMcpList: () => Promise<any>;
    getMcp: (data: any) => Promise<any>;
    getMcpCaps: (data: any) => Promise<any>;
}

export interface FlowListItem {
    ID: number,
    Name: string
}


export interface FlowNode {
    id: string;
    type: string;
    position: { x: number; y: number };
    [key: string]: any; // 允许额外字段
}

export interface FlowEdge {
    id: string;
    source: string;
    target: string;
    sourceHandle?: string;
    targetHandle?: string;
}

export interface FlowData {
    id: number;
    name: string;
    data: Record<string, any>;
    nodes: FlowNode[];
    edges: FlowEdge[];
}

export interface ModelType {
    ID: number;  // 模型ID
    Name: string; // 模型名称
    ModelType: string; // 模型类型
    ModelName: string; // 大模型名称
    ApiKey: string; // api key
    ApiUrl: string; // api url
    MaxContextLength: number; // 最大上下文长度
    StreamingEnabled: boolean; // 是否支持流式
}

export interface CapsItem {
    name: string; // 功能名称
    description: string; // 功能描述
}

export interface McpType {
    ID: number;  // mcp ID
    Name: string; // mcp 名称
    McpType: string; // mcp 类型
    Url: string; // mcp 客户端地址
    Prompts: CapsItem[];
    Tools: CapsItem[];
    Resources: CapsItem[];
}

type ConditionType = 'default' | 'needTools' | 'custom'

export interface ConditionInfo {
    id: string,
    type: ConditionType,
    name: string,
    script?: string,
}